<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return['role']=$_SESSION['role'];
$return['member']=array();
if($_RQ['op']=='main'){
	$return['uid']=$_SESSION['uid'];
	if($_RQ['lat']){
		$return['info']['lat']=cfc('tools')->Convert_GCJ02_To_BD09($_RQ['lat'],$_RQ['lng']);		
	}
	$return['worker_tags']=$this->worker_tags;
	$return['fuwus']=pdo_getall('jy_djhome_serve',array('uniacid'=>$_SESSION['uniacid'],'status'=>1),array('id','title','price','times','image'),'','paixu desc, id desc');	
	$return['pcd']=$this->session('pcd')?:array();
	$return['params']=array('tag'=>0,'serve_id'=>intval($_RQ['serve_id'])?:'','group_id'=>0,'ishot'=>1,'city'=>$return['pcd']['city']?:'广州');
	$return['isorder']=pdo_get('jy_djhome_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>array(0,1,6,7,8)));
	$return['isorder']=$return['isorder']?:array();
	set_html('title','技师列表');
	exi($return);
}
if($_RQ['op']=='getlist'){
	if($_RQ['lat'] || $_RQ['lng']){
		$lat_lng=array('lat'=>$_RQ['lat'],'lng'=>$_RQ['lng']);
		$this->session('lat_lng',$lat_lng);
	}
	$lat_lng=$this->session('lat_lng')?:array('lat'=>'31.235929','lng'=>'121.480539');
	$list=$this->model('worker')->getworkers($lat_lng,$_RQ['maxjuli'],$_RQ['limit'],$_RQ['page']);
	foreach($list as $k=>&$item){
		$item['salenum']=pdo_count('jy_djhome_order',array('uniacid'=>$_SESSION['uniacid'],'worker_id'=>$item['id']));
		$item['pingjia']=pdo_count('jy_djhome_pingjia',array('uniacid'=>$_SESSION['uniacid'],'worker_id'=>$item['id']));
		$item['likes']=pdo_count('jy_djhome_like',array('islike'=>1,'uniacid'=>$_SESSION['uniacid'],'worker_id'=>$item['id']));
		$item['star']=$item['star']>0?$item['star']:'5.00';
		$item['yuetitle']='最早可约:今12:00';
	}
	$return['list']=$list;
	exi($return);
}
if($_RQ['op']=='check_buy'){
	$worker=get_postdata();
	if(!$worker['id']){
		exi('请选择技师！','error');
	}
	if(!count($worker['goods'])){
		exi('请选择项目！','error');
	}
	$this->session('goods',$worker['goods']);
	$resurl='jy_djhome/book//worker_id='.$worker['id'];
	exi($resurl);
}
?>